<?php
error_reporting(E_ALL ^ E_NOTICE);
session_start();
$connect = mysql_connect('localhost','root','');
mysql_select_db("admintool");
?>
<?php
if($_SESSION["loggedin"]==true && $_SESSION["role"]==admin)
{
if(isset($_SESSION[msg]))
{
echo $_SESSION[msg];
unset($_SESSION[msg]);
}
?>
<?php 
$id = $_GET['id'];
$select = "SELECT * FROM  role_management WHERE roleid='$id'";
$edit = mysql_query($select);
$editrole = mysql_fetch_array($edit);

?>
<form action="edit.php" method="post">
<input type="hidden" value="<?php echo "$editrole[roleid]";?> " name="id" />
<input type="text" value="<?php echo "$editrole[rolename]";?>" name="rolename"/>
<input type="submit" name="editrole" value="save"/>
</form>

<?php
if(isset($_POST['editrole']))
{
$id = $_POST['id'];
$update ="UPDATE role_management SET rolename='$rolename' WHERE roleid='$id'";
$ued = mysql_query($update);
header("Location: role_list.php");
}

}
else
{
header("Location: login.php");
}
?>